import Tax.*;
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int sort = scanner.nextInt();
        int sum = scanner.nextInt();
        if(sort < 0 || sort > 3 || sum < 0) {
            System.out.println("Wrong Format");
            return;
        }
        int a = 0, b = 0, c = 0, d = 0, e = 0;
        switch(sort)
        {
            case(0):
            a = 8350;
            b = 33950;
            c = 82250;
            d = 171550;
            e = 372950;
                break;
            case(1):
            a = 16700;
            b = 67900;
            c = 137050;
            d = 208850;
            e = 372950;
                break;
            case(2):
            a = 8350;
            b = 33950;
            c = 68525;
            d = 104425;
            e = 186475;
                break;
            case(3):
            a = 11950;
            b = 45500;
            c = 117450;
            d = 190200;
            e = 372950;
                break;
        }
        Tax tax = null;
        if(sum < a){
            tax = new Tax1(a, b, c, d, e, sum);
        }else if(sum < b) {
            tax = new Tax2(a, b, c, d, e, sum);
        }else if(sum < c) {
            tax = new Tax3(a, b, c, d, e, sum);
        }else if(sum < d) {
            tax = new Tax4(a, b, c, d, e, sum);
        }else if(sum < e) {
            tax = new Tax5(a, b, c, d, e, sum);
        }else {
            tax = new Tax6(a, b, c, d, e, sum);
        }
        System.out.printf("%.2f", tax.getTax());
    }

}